<template>
    <el-col :span="30" >
        <el-dropdown trigger="click" @command="eventcallbacks">
            <span class="el-dropdown-link">
                <el-avatar :size="35" :src="user.avatarUrl" style="cursor:pointer;"></el-avatar>
            </span>
            <template #dropdown>
                <el-dropdown-menu>
                    <el-dropdown-item :icon="UserFilled" :command="0">{{$t('admin.personinfo')}}</el-dropdown-item>
                    <el-dropdown-item :icon="Unlock" :command="1">{{$t('admin.revamppwd')}}</el-dropdown-item>
                    <el-dropdown-item :icon="Right" :command="2">{{$t('admin.logout')}}</el-dropdown-item>
                </el-dropdown-menu>
            </template>
        </el-dropdown>
    </el-col>
</template>

<script lang="ts" setup>
import router from '@/router';
import { UserFilled, Unlock, Right } from '@element-plus/icons-vue' //图标
import {useUserStore} from "@/stores/admin"

const store = useUserStore()
const user = store.user



//跳转页面
const eventcallbacks = (value:any)=>{
    switch (value) {
        case 0:
            router.push('/index/admin')
            break;
        case 1:
            router.push('/index/chengpassword')
            break;
        case 2:
            // 退出登录
            store.Loginout()
            break;
        default:
            break;
    }
}
</script>

<style lang="less" scoped>

</style>